package InterfaceEI;


import javax.swing.Icon;
import javax.swing.JToggleButton;

/**
 *
 * @author Claudio Eduardo Goes
 */
public class BotoesApoios extends javax.swing.JDialog {

    JToggleButton jtbBotao;
    PanelPrincipal panelP;

    /** Creates new form NewJDialog */
    public BotoesApoios(java.awt.Frame parent, boolean modal, JToggleButton jtbBotao, PanelPrincipal panelP) {
        super(parent, modal);
        this.setUndecorated(true);
        initComponents();
        this.jtbBotao = jtbBotao;
        this.panelP = panelP;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jToolBar1 = new javax.swing.JToolBar();
        jBFixoD = new javax.swing.JButton();
        jBEngP = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
                formWindowLostFocus(evt);
            }
        });
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        jToolBar1.setOrientation(1);
        jToolBar1.setRollover(true);

        jBFixoD.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/apoioBiaApoiada.png"))); // NOI18N
        jBFixoD.setToolTipText("Fixo+Deslizante");
        jBFixoD.setFocusable(false);
        jBFixoD.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jBFixoD.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jBFixoD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBFixoDActionPerformed(evt);
            }
        });
        jToolBar1.add(jBFixoD);

        jBEngP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/engastadaBotao.png"))); // NOI18N
        jBEngP.setToolTipText("Engaste+Ponto");
        jBEngP.setFocusable(false);
        jBEngP.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jBEngP.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jBEngP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBEngPActionPerformed(evt);
            }
        });
        jToolBar1.add(jBEngP);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        this.dispose();
    }//GEN-LAST:event_formWindowClosed

    private void formWindowLostFocus(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowLostFocus
        //jtbBotao.setSelected(false);
        formWindowClosed(null);
    }//GEN-LAST:event_formWindowLostFocus

    private void jBFixoDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBFixoDActionPerformed
        panelP.setFixoD(true);

        jtbBotao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/biApoiadaBotao.png")));

        panelP.repaint();
        panelP.validate();
        formWindowClosed(null);
    }//GEN-LAST:event_jBFixoDActionPerformed

    private void jBEngPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBEngPActionPerformed
        panelP.setEngP(true);

        jtbBotao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/engastadaPontoBota.png")));

        panelP.repaint();
        panelP.validate();
        formWindowClosed(null);
}//GEN-LAST:event_jBEngPActionPerformed


    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
//                BotoesApoios dialog = new BotoesApoios(new javax.swing.JFrame(), true, null);
//                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jBEngP;
    private javax.swing.JButton jBFixoD;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables



}
